package linear.queue;

import linear.queue.base.MyArrayLoopQueue;
import linear.queue.base.MyArrayQueue;
import linear.queue.base.MyLinkedQueue;
import linear.queue.base.MyQueue;

/**
 * @author yeyangtao created at 10:49 2020/9/23
 */
public class MyQueueTest {
    public static void main(String[] args) {
        MyQueue<Integer> queue = new MyArrayQueue<>();
        MyQueue<Integer> queue1 = new MyLinkedQueue<>();
        MyQueue<Integer> queue2 = new MyArrayLoopQueue<>();
        Test1(queue2);
    }

    static void Test1(MyQueue<Integer> queue) {
        queue.offer(1);
        queue.offer(2);
        System.out.println(queue);
        System.out.println(queue.peek());
        System.out.println(queue);

        System.out.println(queue.poll());
        System.out.println(queue + "," + queue.size());

        System.out.println(queue.poll());
        System.out.println(queue + "," + queue.size());

        System.out.println(queue.size());
        System.out.println(queue.isEmpty());

        for (int i = 0; i < 20; i++) {
            boolean flag = queue.offer(i);
            System.out.println(i + ":" + flag);
        }
        System.out.println(queue);
    }

}
